package com.mantou.scucorse.core.service;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mantou.scucorse.core.entity.Proxy;
import com.mantou.scucorse.core.repository.ProxyRepository;
import com.mantou.scucorse.core.service.ProxyService;

@Service
public class ProxyService {


	@Resource
	private ProxyRepository proxyRepo;

	@Transactional
	public int create(Proxy proxy) {
		 proxyRepo.insert(proxy);
		 return proxy.getId();
	}

	@Transactional
	public int createSelective(Proxy proxy) {
		 proxyRepo.insertSelective(proxy);
		 return proxy.getId();
	}

	@Transactional
	public int deleteByPrimaryKey(Integer id) {
		return proxyRepo.deleteByPrimaryKey(id);
	}

	@Transactional(readOnly = true)
	public Proxy findByPrimaryKey(Integer id) {
		Proxy proxy = proxyRepo.selectByPrimaryKey(id);
		return proxy;
	}

	@Transactional(readOnly = true)
	public int selectCount(Proxy proxy) {
		return proxyRepo.selectCount(proxy);
	}

	@Transactional
	public int updateByPrimaryKey(Proxy proxy) {
		return proxyRepo.updateByPrimaryKey(proxy);
	}
	
	@Transactional
	public int updateByPrimaryKeySelective(Proxy proxy) {
		return proxyRepo.updateByPrimaryKeySelective(proxy);
	}

}
